feat!: replace polars dependency with arrow; bump to 0.3.0#5
Merged
Conversation
The upstream ggsql crate (v0.3.0) removed polars in favor of a custom
DataFrame built on Arrow RecordBatch. This updates the Python bindings
to match:
Rust side: IPC serialization now uses arrow::ipc::{StreamWriter,StreamReader}
instead of polars IpcWriter/IpcReader. The py_to_df() helper accepts any
object that pyarrow.table() can convert, so custom readers returning polars
DataFrames still work without changes.
Python side: render_altair() calls df.to_arrow() instead of df.to_polars().
Runtime dependency changed from polars to pyarrow.
Public API changes:
- DuckDBReader.execute_sql() returns pyarrow.Table (was polars.DataFrame)
- DuckDBReader.register() accepts pyarrow.Table (polars still works via
automatic conversion)
- Spec.data()/layer_data()/stat_data() return pyarrow.Table
Update all code examples, API docs, and architecture description to reflect that the data bridge now uses pyarrow instead of polars. register() accepts any type that pyarrow.table() can convert (pyarrow, polars, pandas, etc.).
- Replace all pl.DataFrame/pl.LazyFrame usage in tests with pa.table() - Make polars optional in tests (skip polars-specific tests when not installed) - Custom readers now use duckdb .arrow() instead of .pl() - Fix render_altair() where the LazyFrame collect + DataFrame isinstance checks were accidentally collapsed into a single inverted check
DuckDB 1.4+ uses the Windows Restart Manager API (RmStartSession, etc.) which requires linking against rstrtmgr.lib. Without this, Windows builds fail with LNK2019 unresolved externals.
Addresses PR feedback: instead of a generic "Expected a pyarrow.Table or compatible type" message, include the actual Python type name and the underlying pyarrow error for easier debugging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
arrow::ipc::{StreamWriter, StreamReader}and Python side usespyarrow.ipcpolarstopyarrowpy_to_df()accepts anythingpyarrow.table()can convertbuild.rsto linkrstrtmgr.libon Windows (required by DuckDB 1.4+)Public API changes
DuckDBReader.execute_sql()returnspyarrow.Table(waspolars.DataFrame)DuckDBReader.register()acceptspyarrow.Table(polars/pandas also accepted via automatic conversion)Spec.data()/layer_data()/stat_data()returnpyarrow.TableTest plan